/**
 * Copyright (C) 2012 Foxit Corporation.
 * All Rights Reserved.
 *
 * The following code is copyrighted and contains proprietary information and trade secrets of Foxit Corporation. 
 * You can only redistribute files listed below to customers of your application, under a written SDK license agreement with Foxit. 
 * You cannot distribute any part of the SDK to general public, even with a SDK license agreement. 
 * Without SDK license agreement, you cannot redistribute anything.
 * 
 * @file	fgstxt.h
 * @brief   Header file for TXT Module.
 * @details	The TXT module offers:
 *			1. Check codepage.
 *			2. Load text file.
 *			3. Layout.
 *			4. Adjust section layout.
 * @note	If you want to purchase Foxit PDF SDK license and use ANY of the following functions, please
 *			request for enabling TXT module explicitly. 
 */

/**
 * @addtogroup FGSTXT TXT Base
 * @brief Methods in this module are included in fgstxt.h.
 */
/**@{*/

#ifndef __FGSTXT__
#define __FGSTXT__

#if defined(__cplusplus)
extern "C" {
#endif

#include "../dp/fgsdp.h"

/**
 * @brief 		Get the TXT module.
 * @details		Application must call this function to get the TXT module first.<br>
 *
 * @return	Reference to a TXT module.
 */
FGSDPModuleRef FGSTXTModuleGet();

/**
 * @brief 		Stop using TXT module and release all resources.
 * @details		All loaded documents and pages will become invalid after this call.<br>
 *
 * @param[in] module		Reference to a TXT module.
 *
 * @return  None.
 */
void FGSTXTModuleExit(FGSDPModuleRef module);

/**
 * @brief Start loading a TXT file.
 *
 * @param[in] fileStream		Reference to a file stream.
 * @param[in] sectionSize		Section size in byte.
 * @param[in] codePage			Refers to enum definitions of <b>FGSCharset</b>.
 *
 * @return	Reference to a <b>::FGSDPDocumentRef</b> object.
 */
FGSDPDocumentRef FGSTXTDocumentLoad(
    FGSFileStreamInRef   fileStream,
    SInt32              sectionSize,
    SInt32              codePage);

/**
 * @brief Set the layout param in the document loading process.
 * @details	You can only call it when change the params.
 *
 * @param[in] document			Reference to a FDP document. 
 * @param[in] font				Reference to a font. 
 * @param[in] fontSize			The font size.
 * @param[in] pageWidth			The desired page width, in page coordination.
 * @param[in] pageHeight		The desired page height, in page coordination.
 * @param[in] parseMode			Refers to macros of <b>FGSDPParseMode</b>.
 * @param[in] writingMode		Flag for layout direction, It must be <b>FGSDPMode</b>.
 * @param[in] color				Text Color. 
 * @param[in] bReparse			Whether reparse or not.
 *
 * @return	::kFGSErrorSuccess means success.<br>
 *			For more definitions please see enum definitions <b>FGSErrorRet</b>.
 */
FGSErrorRet FGSTXTDocumentSetLayoutParams(
    FGSDPDocumentRef     document,
    FGSFontRef           font,
    Float32             fontSize,
    Float32             pageWidth,
    Float32             pageHeight,
    FGSDPParseMode      parseMode,
    FGSDPMode           writingMode,
	UInt32				color,
    Boolean             bReparse);

/**
 * @brief Close a txt document and free all associated resources.
 *
 * @param[in] document			Reference to a FDP document.
 *
 * @return	::kFGSErrorSuccess means success.<br>
 *			For more definitions please see enum definitions <b>FGSErrorRet</b>.
 */
FGSErrorRet FGSTXTDocumentClose(FGSDPDocumentRef document);
/** @} */

#if defined(__cplusplus)
}
#endif

#endif // __FGSTXT__
/** @} */
